/*
 * list.h
 *
 *  Created on: 2011-11-23
 *      Author: xugp
 */

#ifndef LIST_H_
#define LIST_H_

struct _node_t{
	void * data;
	struct _node_t *pre;
	struct _node_t *next;
};

struct _list_t{
	pthread_mutex_t list_lock;
	struct _node_t * head;
	struct _node_t * tail;
	int count;
};
typedef struct _node_t node_t;
typedef struct _list_t list_t;


list_t * list_create();
void list_free(list_t * plist);
void lock_list(list_t * plist);
void unlock_list(list_t * plist);
node_t * list_push_head(void * data,list_t * plist);
node_t * list_push_tail(void * data,list_t * plist);
void * list_pop_head(list_t *plist);
void * list_pop_tail(list_t *plist);
//访问节点以及删除节点时，必须先手工锁定,不建议使用哦

node_t * list_delete(node_t *node,list_t * plist);

#endif /* LIST_H_ */
